# -*- coding: utf-8 -*-
# @Author : 17
# @Time    : 2024/4/26 10:21
# @File    : add_bug_msg.py
from feishu.feishu_notice import FeiShutalkChatbot
from notice.add_bug_notice import add_bug


def add_bug_msg():

    for bug_group in add_bug():
        for bug in bug_group:
            msg = "- - - - - - BUG 创建提醒 - - - - - -\n\n Bug_ID：{0}\n Bug内容：{1}\n 接收人：{2}\n 发起人：{3}\n \
地址：http://192.168.6.21:8888/zentao/bug-browse-{4}.html?PRJ={5}\n ".format(bug['id'],
                                                                            bug["title"],
                                                                            bug['realname'],
                                                                            bug['openName'],
                                                                            bug['product'],
                                                                            bug["PRJ"])

            webhook = "https://open.feishu.cn/open-apis/bot/v2/hook/917fe499-a821-4624-baec-73b85f099b04"
            feishu = FeiShutalkChatbot(webhook)
            feishu.send_text(msg)


add_bug_msg()